/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package submarines;

import submarines.notices.*;
/**
 *
 * @author Shmiti
 */
public class MediumEaPlayer extends EaPlayer {
    
    public MediumEaPlayer(String userName, int userScore) {
        super(userName, userScore);
    }
    
    @Override
    public void notifyPlayerGotHit(Notice currNotice) {
        super.notifyPlayerGotHit(currNotice);
        NoticePlayerGotHit n = (NoticePlayerGotHit)currNotice;
        int row;
        int col;
        Player enemy;
        
        row = n.getRow();
        col = n.getCol();
        enemy = n.getPlayer();
        
        if ((row != 0) && (col != 0))
            markOnBoard(Config.MARKED_SQUARE_SIGN, enemy.getName(), row - 1, col - 1);
        if ((row != 0) && (col != Config.BOARD_SIZE))
            markOnBoard(Config.MARKED_SQUARE_SIGN, enemy.getName(), row - 1, col + 1);
        if ((row != Config.BOARD_SIZE) && (col != 0))
            markOnBoard(Config.MARKED_SQUARE_SIGN, enemy.getName(), row + 1, col - 1);
        if ((row != Config.BOARD_SIZE) && (col != Config.BOARD_SIZE))
            markOnBoard(Config.MARKED_SQUARE_SIGN, enemy.getName(), row + 1, col + 1);
    }
    
    @Override
    public void notifyPlayerSubmarineSunk(Notice currNotice) {
        super.notifyPlayerSubmarineSunk(currNotice);
        // Needs to be implemented to "seal" the 1 square round around the submarine.
        //Note: only need to deal with the begining of the submarine and the end
        
    }
}
